package com.boot.security.server.dao;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.boot.security.server.model.TGoodsCategory;

@Mapper
public interface TGoodsCategoryDao {

    @Select("select * from t_goods_category t where t.id = #{id}")
    TGoodsCategory getById(Long id);

    @Delete("delete from t_goods_category where id = #{id}")
    int delete(Long id);

    int update(TGoodsCategory tGoodsCategory);
    
    @Options(useGeneratedKeys = true, keyProperty = "id")
    @Insert("insert into t_goods_category(category_id, parent_id, category_name, image, state, simple_describe, recommend, create_time, update_time, admin_id) values(#{categoryId}, #{parentId}, #{categoryName}, #{image}, #{state}, #{simpleDescribe}, #{recommend}, #{createTime}, #{updateTime}, #{adminId})")
    int save(TGoodsCategory tGoodsCategory);
    
    int count(@Param("params") Map<String, Object> params);

    List<TGoodsCategory> list(@Param("params") Map<String, Object> params, @Param("offset") Integer offset, @Param("limit") Integer limit);
}
